<?php
session_start();
require_once substr(dirname(__FILE__), 0, -5).'include/common.php';
if(@$_POST['name']&&@$_POST['pass']){
	$name=new_addslashes(new_trim($_POST['name']));
	$pass=new_addslashes(new_trim($_POST['pass']));
	$err="用户名或密码错误！";
	if(!preg_match("/^[a-zA-Z][\w_\.]{3,20}$/",$name))	msg($err);
	if(strlen($pass)<6)	msg($err);
	$pwd=md5($pass);
	$r=$db->getone("select id from admin where user='$name' and pwd='$pwd' and status<=5");
	if(!$r)	msg($err);
	$_SESSION['admin']=$r["id"];
	msg("登陆成功","/admin/");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Admin Login Page</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8" />
<LINK href="css/admin.css" type="text/css" rel="stylesheet" />
</HEAD>
<BODY onload=document.form1.name.focus();>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" bgColor=#002779 
border=0>
  <TR>
    <TD align=middle>
      <TABLE cellSpacing=0 cellPadding=0 width=468 border=0>
        <TR>
          <TD><IMG height=23 src="images/login_1.jpg" 
          width=468 /></TD></TR>
        <TR>
          <TD><IMG height=147 src="images/login_2.jpg" 
            width=468 /></TD></TR></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width=468 bgColor=#ffffff border=0>
        <TR>
          <TD width=16><IMG height=122 src="images/login_3.jpg" 
            width=16 /></TD>
          <TD align=middle>
            <TABLE cellSpacing=0 cellPadding=0 width=230 border=0>
              <FORM name=form1 action="" method=post>
              <TR height=5>
                <TD width=5></TD>
                <TD width=56></TD>
                <TD></TD></TR>
              <TR height=36>
                <TD></TD>
                <TD>用户名</TD>
                <TD><INPUT 
                  style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" 
                  maxLength=30 size=24 value="" name="name" /></TD></TR>
              <TR height=36>
                <TD>&nbsp; </TD>
                <TD>口　令</TD>
                <TD><INPUT 
                  style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" 
                  type=password maxLength=30 size=24 value="" 
                name="pass" /></TD></TR>
              <TR height=5>
                <TD colSpan=3></TD></TR>
              <TR>
                <TD>&nbsp;</TD>
                <TD>&nbsp;</TD>
                <TD><INPUT type=image height=18 width=70 
                  src="images/bt_login.gif" /></TD></TR></FORM></TABLE></TD>
          <TD width=16><IMG height=122 src="images/login_4.jpg" 
            width=16 /></TD></TR></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width=468 border=0>
        <TR>
          <TD><IMG height=16 src="images/login_5.jpg" 
          width=468 /></TD></TR></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width=468 border=0>
        <TR>
          <TD align=right></TD></TR></TABLE></TD></TR></TABLE></BODY></HTML>
